package cn.software.util;

/**
 * @Author gxy
 * @Date 2023/5/30 12:53
 * @PackageName:cn.software.util
 * @ClassName: Result
 */
public class Result {

    int code;
    String msg;
    Object data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Result(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static Result success(Object data) {
        return new Result(200, "成功", data);
    }

    public static Result fail(String msg) {
        return new Result(ResultEnum.FAIL_DEFAULT.code, msg, null);
    }
}
